<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <ui:composition template="/modelo/templateComMenu.xhtml">
        <ui:define name="conteudo">
            <h:form id="formParticipante" 
                    enctype="multipart/form-data">
                <p:panel id="panel"
                         header="Formulário de Cadastro">
                    <h:inputHidden id="id" value="#{participanteBean.participante.id}"/>
                    
                    <h:panelGrid columns="3">
                        <span>Nome: </span>
                        <p:inputText id="txNome"
                                     value="#{participanteBean.participante.nome}"
                                     label="Nome"
                                     required="true"/>
                        <p:message for="txNome"/>

                        <span>Endereço: </span>
                        <p:inputText id="txEndereco"
                                     value="#{participanteBean.participante.endereco}"
                                     label="Endereço"
                                     required="true"/>
                        <p:message for="txEndereco"/>

                        <span>RG: </span>
                        <p:inputMask id="txRG"
                                     value="#{participanteBean.participante.rg}"
                                     label="RG"
                                     required="true"
                                     mask="99.999-99"/>
                        <p:message for="txRG"/>
                        
                        <span>Sexo: </span>
                        <p:selectOneMenu id="slOMSexo"
                                         value="#{participanteBean.participante.sexo}"
                                         label="Sexo"
                                         required="true">
                            <f:selectItem itemLabel="" noSelectionOption="true"/>
                            <f:selectItem itemLabel="Masculino" itemValue="M"/>
                            <f:selectItem itemLabel="Feminino" itemValue="F"/>
                        </p:selectOneMenu>
                        <p:message for="slOMSexo"/>

                        <span>Instituição: </span>
                        <p:selectOneMenu id="slOMSexoInstituicao"
                                         value="#{participanteBean.participante.instituicao}"
                                         label="Instituição"
                                         required="true">
                            <f:selectItem itemLabel="" noSelectionOption="true"/>
                            <f:selectItem itemLabel="UFRA" itemValue="UFRA"/>
                            <f:selectItem itemLabel="Outros" itemValue="Outros"/>
                        </p:selectOneMenu>
                        <p:message for="slOMSexoInstituicao"/>

                        <span>Modalidade: </span>
                        <p:selectOneMenu id="slOMSexoModalidade"
                                         value="#{participanteBean.participante.modalidade}"
                                         label="Modalidade"
                                         required="true">
                            <f:selectItem itemLabel="" noSelectionOption="true"/>
                            <f:selectItem itemLabel="Participação" itemValue="Participação"/>
                            <f:selectItem itemLabel="Apresentação Oral" itemValue="Apresentação Oral"/>
                            <f:selectItem itemLabel="Apresentação Painel" itemValue="Apresentação Painel"/>
                        </p:selectOneMenu>
                        <p:message for="slOMSexoModalidade"/>

                        <span>Telefone: </span>
                        <p:inputMask id="txFone"
                                     value="#{participanteBean.participante.fone}"
                                     label="Telefone"
                                     required="true"
                                     mask="(99) 9999-9999"/>
                        <p:message for="txFone"/>

                        <span>Email: </span>
                        <p:inputText id="txEmail"
                                     value="#{participanteBean.participante.email}"
                                     label="Email"
                                     required="true"/>
                        <p:message for="txEmail"/>
                        
                        <span>Resumo: </span>
                        <p:fileUpload id="resumo"
                                      value="#{participanteBean.file}"
                                      mode="simple"
                                      allowTypes="/(\.|\/)(pdf)$/"
                                      label="Arquivo"
                                      required="true"/>
                        <p:message for="resumo"/>
                    </h:panelGrid>
                    <p>
                        <p:commandButton id="cbEnviar"
                                         ajax="false"
                                         value="Enviar"
                                         action="#{participanteBean.enviar()}"/>
                        <p:button id="cbVoltar"
                                  value="Voltar"
                                  outcome="index"/>
                    </p>
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>
</html>

